package com.example.myapplication;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager2.adapter.FragmentStateAdapter;

public class MyFragmentStateAdapter extends FragmentStateAdapter {
    public MyFragmentStateAdapter(FragmentActivity fragmentActivity){
        super(fragmentActivity);
    }
    @Nullable
    @Override
    public Fragment createFragment(int position){
        switch (position)
        {
            case 0:
                return new Simple1Fragment();
            case 1:
                return new Simple2Fragment();
            /*case 2:
                return new Simple3Fragment();*/
        }
        return null;
    }
    @Override
    public int getItemCount()
    {
        return 2;
    }
}
